﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using MaxAlarm.Core.Items;
using MaxAlarm.Core.Utility;
using MaxAlarm.Core.WebQueries;
using MaxAlarm.ViewModels;
using MaxAlarm.Windows;

namespace MaxAlarm
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{
	    public static readonly DependencyProperty ViewModelProperty =
	        DependencyProperty.Register("ViewModel", typeof (MainWindowViewModel), typeof (MainWindow), new PropertyMetadata(default(MainWindowViewModel)));

	    public MainWindowViewModel ViewModel
	    {
	        get { return (MainWindowViewModel) GetValue(ViewModelProperty); }
	        set { SetValue(ViewModelProperty, value); }
	    }

		public MainWindow()
		{
            Loaded += LoadedWindow;
			InitializeComponent();
		    ViewModel = DataContext as MainWindowViewModel;
            SizeChanged += OnSizeChanged; 
		}

	    private void OnSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs)
	    {
	    }

	    public void DragWindow(object sender, RoutedEventArgs e)
		{
			DragMove();
		}
		
		public void CloseWindow(object sender, RoutedEventArgs e)
		{
			Close();
		}

        public void MinimizeWindow(object sender, RoutedEventArgs e)
        {
           WindowState = WindowState.Minimized;
        }

        public void MaximizeWindow(object sender, RoutedEventArgs e)
        {
            WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
        }

        private void LoadedWindow(object sender, RoutedEventArgs e)
        {
            //WebQuery.GetCookies("http://mail.ru");
        }
	}
}